<!-- toaster directive -->
<toaster-container
        toaster-options="{'position-class': 'toast-top-right', 'close-button':true}">

</toaster-container>
<!-- / toaster directive -->

<!-- 导航条 -->
<div class="bg-white bread-crumb">
    <ul class="breadcrumb b-a m-b-n-xs lter b-b wrapper-md">
        <li><a ui-sref="main"><i class="glyphicon glyphicon-user"></i> 人员管理</a></li>
        <li><a ui-sref="main.member.personHouse.list" class="active">人员房屋关系</a></li>
        <li class="active" ng-bind="title"></li>
    </ul>
</div>


<object classid="clsid:727B872C-BB7A-418E-82D5-D99FF36F7C4E" codebase="../IdCardRead.msi" id="IdCardRead" width="0"
        height="0">
</object>
<object classid="clsid:2FF94F50-4070-428B-8049-AA7F4153DBEB" codebase="../webSerial.msi" width="0" height="0"
        id="webSerial" name="webSerial">
</object>
<div ng-show="loading" class="text-center m-t-md text-lg dataWarn"><i class="fa fa-spin fa-spinner"></i> 数据加载中...</div>
<!-- 内容区域 -->
<div class="wrapper-md content" id="AddNewMenber">
    <div class="panel panel-default">
        
        <div class="panel-heading font-bold">
            <a class="btn btn-sm btn-icon btn-rounded btn-default pull-right m-t-n-xs"ui-sref="main.member.personHouse.list">
                <i class="text-md glyphicon glyphicon-chevron-up text-muted"></i>
            </a>
        </div>
        <!--表单-->

        <div class="panel-body">

            <form class="form-horizontal" name="user_form">

                <div class="essential-information">
                    <h6 style="margin-top:0px;font-size: 18px;">基本信息</h6>
                    <hr>
                    <div class="form-group">
                        <!-- 人员姓名 -->
                        <label class="col-lg-2 col-sm-3 control-label" for="personName">
                            <span class="text-danger wrapper-sm">*</span>人员姓名：
                        </label>
                        <div class="col-lg-4">
                            <input type="text" class="form-control" name="personName" id="personName"
                                   placeholder="请输入您的真实姓名..." ng-model="record.personName"
                                   ng-click="openPersonInfo()"required
                                   value="" 
                            >
                        </div>
                    </div>

                    <div class="form-group">
                        <!-- 关系类型 -->
                        <label class="col-lg-2 col-sm-3 control-label" for="relationType">
                            <span class="text-danger wrapper-sm">*</span>关系类型：
                        </label>
                        <div class="col-lg-4">
                            <select class="form-control" ng-model="record.relationType"
                                    name="relationType" id="relationType">
                                <!-- <option value="" ng-selected="2"></option> -->
                                <option value="0">租赁</option>
                                <option value="1">自有</option>
                            </select>
                        </div>
                    </div>

                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    
                    <div class="form-group">
                        <!-- 关系类型 -->
                        <label class="col-lg-2 col-sm-3 control-label" for="personType">
                            <span class="text-danger wrapper-sm">*</span>人员类型：
                        </label>
                        <div class="col-lg-4">
                            <select class="form-control" ng-model="record.personType"
                                    name="personType"id="personType">
                                <!-- <option value="" ng-selected="2"></option> -->
                                <option value="0">租客</option>
                                <option value="1">房东</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <!-- 房屋类型 -->
                        <label class="col-lg-2 col-sm-3 control-label" for="objcetType">
                            <span class="text-danger wrapper-sm">*</span>房屋类别：
                        </label>
                        <div class="col-lg-4">
                            <select class="form-control" ng-model="record.objcetType"id="objcetType" name="objcetType" ng-change="rewriteInfo()" >
                                <option value="0">房屋</option>
                                <option value="1">楼栋</option>
                            </select>
                        </div>
                    </div>

                    <div class="line line-dashed b-b line-lg pull-in"></div>

 					<div class="form-group">
                        <!-- 房屋地址 -->
                        <label class="col-lg-2 col-sm-3 control-label" for="address">
                            <span class="text-danger wrapper-sm">*</span>房屋地址：
                        </label>
                        <div class="col-lg-4">
                            <input type="text" class="form-control" name="address"
                                   id="address" placeholder="请确认您的房屋地址..."
                                   ng-model="record.address" ng-click="openInfo()"> <span
                                class="help-block m-b-none"></span>
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <!-- 开始时间 -->
                        <label class="col-lg-2 col-sm-3 control-label" for="startDate">
                            <span class="text-danger wrapper-sm">*</span>开始时间：
                        </label>
                        <div class="col-lg-4">
                            <div class="input-group m-d">
                                <input type="text"
                                       class="form-control ng-pristine ng-valid ng-isolate-scope ng-empty ng-valid-date ng-touched"
                                       name="startDate"
                                       current-text="今天" clear-text="清除" close-text="关闭" datepicker-popup="yyyy-MM-dd"
                                       ng-model="record.startDate"
                                       id="startDate" is-open="startDate" datepicker-options="dateOptions"
                                       placeholder="开始时间"
                                >
                                <span class="help-block m-b-none"></span>
                                <span class="input-group-btn">
								    <button type="button" class="btn btn-default" ng-click="openDatepicker($event,1)">
								    <i class="glyphicon glyphicon-calendar"></i>
								    </button>
                                </span>
                            </div>
                        </div>
                    </div>
           
                    <div class="line line-dashed b-b line-lg pull-in"></div>
			         <div class="form-group">
			                        <!-- 结束时间 -->
			                        <label class="col-lg-2 col-sm-3 control-label" for="endDate">
			                            <span class="text-danger wrapper-sm">*</span>结束时间：
			                        </label>
			                        <div class="col-lg-4">
			                            <div class="input-group m-d">
			                                <input type="text"
			                                       class="form-control ng-pristine ng-valid ng-isolate-scope ng-empty ng-valid-date ng-touched"
			                                       name="endDate"
			                                       current-text="今天" clear-text="清除" close-text="关闭" datepicker-popup="yyyy-MM-dd"
			                                       ng-model="record.endDate"
			                                       id="endDate" is-open="endDate" datepicker-options="dateOptions"
			                                       close-text="Close" placeholder="结束时间"
			                                >
			                                <span class="help-block m-b-none"></span>
			                                <span class="input-group-btn">
											    <button type="button" class="btn btn-default" ng-click="openDatepicker($event,2)">
											    <i class="glyphicon glyphicon-calendar"></i>
											    </button>
			                                </span>
			                            </div>
			                        </div>
			              </div>
                    <!-- 测试要求屏蔽掉手机号码 -->
                    <!-- 手机号码 -->
                    <!-- <div class="form-group">
                        <label class="col-lg-2 col-sm-3 control-label" for="mobileNo">
                            <span class="text-danger wrapper-sm">*</span> 手机号码 :
                        </label>
                        <div class="col-lg-4" ng-show="isAdd">
                        <input type="text" class="form-control" name="mobileNo"
                               id="mobileNo" placeholder="请输入您的手机号码..."
                               ng-model="record.mobileNo"
                               pattern="^1[34578]\d{9}$"
                        >
                         </div>
                        此处用于回显，不提供输入手机号码修改功能,如果是编辑就是显示这个
                        <div class="col-lg-4">
                            <span class="form-control" name="mobileNo"
                            id="mobileNo">{{record.mobileNo}}</span>
                            <span class="help-block m-b-none"> </span>
                        </div>
                    </div>-->
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <!--btn-->
                    <div class="form-group btnBox" style="width: 100%">
                        <div class="col-sm-6 col-sm-offset-2 text-center"style="width: 100%;margin: 0;padding: 0;text-align: center">
                            <button type="button" class="btn  w-xs addNew" ng-show="reset" ng-click="resetFrom()">重置</button>
                            <button type="submit" class="btn btn-info w-xs m-l-xl addNew"
                                    ng-disabled="isDisabled">保存
                            </button>
                        </div>
                    </div>

            </form>

        </div>
    </div>

</div>

<!--当前页面私用的样式-->
<style scoped>
    #AddNewMenber .btnBox {
        width: 100% !important;
    }

    #AddNewMenber .btnBox .col-lg-4 {
        margin-left: 0;
        width: 100% !important;
    }

    #AddNewMenber .form-group {
        width: 50%;
        float: left;
    }

    #AddNewMenber .form-group .col-lg-2 {
        width: 25%;
    }

    #AddNewMenber .form-group .col-lg-4 {
        width: 65%;
    }

    .backgo {
        background-color: #78a7ff;
        margin-right: 40px;
    }

    .btnBox {
        width: 100%;
    }

    .btnBox .col-lg-4 {
        width: 100%;
        text-align: right;
        margin: 0;
        padding: 0;
    }

    .backgo:hover, .backgo:active, .backgo:focus {
        background-color: #577dd0;
        color: #fff !important;
    }

    /*!*弹层宽度*!*/
    /*@media screen and (min-width:500px) {*/
    /*.modal-content {*/
    /*width: 1200px !important;*/
    /*}*/
    /*}*/
    .bread-crumb {
        position: fixed;
        top: 55px;
        z-index: 999;
    }

</style>

<!-- 房屋模态框 -->
<script type="text/ng-template" id="personHouseList.html">
    <!-- 内容区域 -->
    <div ng-hide="loading" class="wrapper-md content">
        <!-- 数据显示 -->
        <div class="wrapper-data">
            <div class="panel panel-default">
                <!-- 头部 -->
                <div class="panel-heading clearfix">

                    <div class="w-auto">
                        <form ng-submit="search()" class="form-inline">

                            <div class="form-group">
                                <label for="address">房屋地址：</label>
                                <input type="text"
                                  class="form-control" style="width: 180px"
                                  id="address"
                                  placeholder="" ng-model="param.address">
                            </div>

                            <div class="form-group">
                                <button type="submit" class="btn btn-primary new-primary"
                                        style="margin-left: 10px">查询
                                </button>
                            </div>
                        </form>
                    </div>
                </div>

                <!-- 数据表格 -->
                <div class="table-responsive">
                    <table class="table table-striped b-t b-light text-center">
                        <thead>
                        <tr>
                            <th ng-show="tag==1">选择</th>
                            <th>房屋地址</th>

                            <th ng-show="tag==0">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="item in pageInfo.data">
                            <td class="v-middle">{{item.address}}</td>
                            
                            <td ng-show="tag==0" class="v-middle">
                                <a ng-click="selectHouses(item.houseCode,item.address,item.houseId,item.houseName)">选择</a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div><!-- /.table-responsive -->

                <!-- 底部分页 -->
                <span data-ng-include=" 'src/tpl/pageInfo.html' "></span>
            </div><!-- /.panel -->
        </div><!-- /.wrapper-data -->

    </div><!-- /.wrapper-md -->

    <div class="modal-footer">
        <button class="btn btn-info addNew" ng-show="tag==1" ng-click="saveHouse()">确定</button>
        <button class="btn btn-warning addNew" ng-click="cancel()">取消</button>
    </div>
</script>

<!-- 楼栋模态框 -->
<script type="text/ng-template" id="personBuilding.html">
    <!-- 内容区域 -->
    <div ng-hide="loading" class="wrapper-md content">
        <!-- 数据显示 -->
        <div class="wrapper-data">
            <div class="panel panel-default">
                <!-- 头部 -->
                <div class="panel-heading clearfix">

                    <div class="w-auto">
                        <form ng-submit="search()" class="form-inline">

                            <div class="form-group">
                                <label for="identity">楼栋名称：</label> <input type="text" class="form-control"
                                                                           style="width: 180px" id="identity"
                                                                           placeholder="" ng-model="param.buildingName">
                            </div>
                            <div class="form-group">
                                <label for="name">楼栋地址：</label> <input type="text" class="form-control"
                                                                       style="width: 180px" placeholder=""
                                                                       ng-model="param.buildingAddress">
                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-primary new-primary"
                                        style="margin-left: 10px">查询
                                </button>
                            </div>
                        </form>
                    </div>
                </div>

                <!-- 数据表格 -->
                <div class="table-responsive">
                    <table class="table table-striped b-t b-light text-center">
                        <thead>
                        <tr>
                            <th ng-show="tag==1">选择</th>
                            <th>楼栋名称</th>
                            <th>楼栋地址</th>
                            <th>楼栋编号</th>
                            <th>状态</th>
                            <th ng-show="tag==0">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="item in pageInfo.data">
                            <td ng-show="tag==1" class="v-middle">
                                <input type="checkbox" ng-checked="isChecked(item.houseId)" class="form-control"
                                       ng-model="record.buildingid" name="buildingid" ng-click="updateSelection($event,item)">
                            </td>
                            <td class="v-middle">{{item.buildingname}}</td>
                            <td class="v-middle">{{item.buildingaddress}}</td>
                            <td class="v-middle">{{item.buildingno}}</td>
                            <td class="v-middle">
                               <span ng-if="item.status==1" class="text-success">有效</span>
                               <span ng-if="item.status==0" class="text-danger">无效</span>
                            </td>
                            <td ng-show="tag==0" class="v-middle">
                                <a ng-click="selectBuilding(item.buildingaddress,item.buildingid,item.buildingname)">选择</a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div><!-- /.table-responsive -->

                <!-- 底部分页 -->
                <span data-ng-include=" 'src/tpl/pageInfo.html' "></span>
            </div><!-- /.panel -->
        </div><!-- /.wrapper-data -->

    </div><!-- /.wrapper-md -->

    <div class="modal-footer">
        <button class="btn btn-info addNew" ng-show="tag==1" ng-click="saveHouse()">确定</button>
        <button class="btn btn-warning addNew" ng-click="cancel()">取消</button>
    </div>
</script>

<!-- 人员模态框 -->
<script type="text/ng-template" id="personInfoList.html" >
    <!-- 内容区域 -->
    <div ng-hide="loading" class="wrapper-md content">
        <!-- 数据显示 -->
        <div class="wrapper-data">
            <div class="panel panel-default">
                <!-- 头部 -->
                <div class="panel-heading clearfix">

                    <div class="w-auto">
                        <form ng-submit="searchP()" class="form-inline">

                            <div class="form-group">
                                <label for="name">人员姓名：</label> <input type="text"
                                                                       class="form-control" style="width: 180px"
                                                                       placeholder="" ng-model="paramP.personName">
                            </div>
                            <div class="form-group">
                                <label for="name">身份证号码：</label> <input type="text"
                                                                        class="form-control" style="width: 180px"
                                                                        placeholder="" ng-model="paramP.IDCardNo">
                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-primary"
                                        style="margin-left: 10px">查询</button>
                            </div>
                        </form>
                    </div>
                </div>

                <!-- 数据表格 -->
                <div class="table-responsive">
                    <table class="table table-striped b-t b-light text-center">
                        <thead>
                        <tr>
                            <th>人员姓名</th>
                            <th>身份证号码</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>

                        <tr ng-repeat="item in pageInfo.data">
                            <td class="v-middle">{{item.personName}}</td>
                            <td class="v-middle">{{item.IDCardNo}}</td>
                            <td class="v-middle">
                                <a ng-click="selectPersons(item.personId,item.personName,item.IDCardNo,item.mobileNo)">选择</a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div><!-- /.table-responsive -->

                <!-- 底部分页 -->
                <span data-ng-include=" 'src/tpl/pageInfo.html' "></span>
            </div><!-- /.panel -->
        </div><!-- /.wrapper-data -->

    </div><!-- /.wrapper-md -->
    <div class="modal-footer">
        <button class="btn btn-warning" ng-click="cancel()">取消</button>
    </div>
</script>

<style scoped>
    .app-content-body .content{
        margin-top:22px;
        background:#fff;
    }
</style>